﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace DataAccessLayer.Models
{
    [MetadataType(typeof(FacilityMetadata))]
    public partial class Facility
    {
    }

    public class FacilityMetadata
    {
        [DisplayName("Facility Name")]
        [Required(ErrorMessage = "Facility Name is mandatory")]
        [StringLength(20, ErrorMessage = "Facility Name must be within 20 characters")]
        public string FacilityName { get; set; }

        [DisplayName("Repayment Amount")]
        [Required(ErrorMessage = "Repayment Amount is mandatory")]
        [RegularExpression("^[0-9]+$", ErrorMessage = "Repayment Amount must be numeric characters")]
        public float RepaymentAmount { get; set; }

        [DisplayName("Repayment Period")]
        [Required(ErrorMessage = "Repayment Period is mandatory")]
        public int RepaymentPeriod { get; set; }

        [DisplayName("Repayment Unit")]
        [Required(ErrorMessage = "Repayment Unit is mandatory")]
        [StringLength(1, ErrorMessage = "Repayment Unit must be 1 character only")]
        public char RepaymentUnit { get; set; }

        [DisplayName("Limit Amount")]
        [Required(ErrorMessage = "Limit Amount is mandatory")]
        [RegularExpression("^[0-9]+$", ErrorMessage = "Limit Amount must be numeric characters")]
        public float LimitAmount { get; set; }

        [DisplayName("Admin Fee")]
        [Required(ErrorMessage = "Admin Fee is mandatory")]
        [RegularExpression("^[0-9]+$", ErrorMessage = "Admin Fee must be numeric characters")]
        public float AdminFee { get; set; }

        [DisplayName("Cancel Fee")]
        [Required(ErrorMessage = "Cancel Fee is mandatory")]
        [RegularExpression("^[0-9]+$", ErrorMessage = "Cancel Fee must be numeric characters")]
        public float CancelFee { get; set; }

        [DisplayName("Tenor Period")]
        [Required(ErrorMessage = "Tenor Period is mandatory")]
        public int TenorPeriod { get; set; }

        [DisplayName("Tenor Unit")]
        [Required(ErrorMessage = "Tenor Unit is mandatory")]
        [StringLength(1, ErrorMessage = "Tenor Unit must be 1 character only")]
        public char TenorUnit { get; set; }
    }

    [MetadataType(typeof(InterestMetadata))]
    public partial class Interest
    {
    }

    public class InterestMetadata
    {
        [DisplayName("Interest Type")]
        [Required(ErrorMessage = "Interest Type is mandatory")]
        [StringLength(1, ErrorMessage = "Interest Type must be 1 character only")]
        public string Type { get; set; }

        [DisplayName("Interest")]
        [Required(ErrorMessage = "Intereset Percent is mandatory")]
        [RegularExpression("^[0-9]+$", ErrorMessage = "Interest Percent must be numeric characters")]
        public float Percent { get; set; }
    }

}
